Skip to content

Fix .my_name resolution and add source(self) annotation for beliefs#21

Open
mrebollo wants to merge 3 commits intoniklasf:masterfrom
mrebollo:ain-version
Open

Fix .my_name resolution and add source(self) annotation for beliefs#21
mrebollo wants to merge 3 commits intoniklasf:masterfrom
mrebollo:ain-version

Conversation

@mrebollo
Copy link
Copy Markdown

@mrebollo mrebollo commented Apr 8, 2026

Summary

This PR fixes .my_name resolution in agentspeak/stdlib.py, adds source(self) annotations for beliefs created without an explicit source in agentspeak/runtime.py, and enables the counting example for runtime validation.

Changes

  • Update .my_name unification to use str(agent.name) instead of Literal(agent.name).
  • Add source(self) automatically when a belief is inserted without an existing source(...) annotation.
  • Enable .my_name usage in examples/counting/counting.asl so the example prints the agent name at the end of counting.

Why

These changes improve consistency in two areas:

  • .my_name should unify with a plain string value.
  • beliefs inserted locally without a source should carry source(self) so their origin is explicit and consistent with message-based beliefs.

Validation

Validated locally by running:

  • pytest -q tests/test_stdlib.py tests/test_terms.py tests/test_parser.py
  • python -m agentspeak examples/counting/counting.asl

The test suite passed, and the counting example printed the resolved agent name correctly.

Scope

This PR is limited to python-agentspeak changes related to:

  • .my_name resolution
  • automatic source(self) annotation for beliefs
  • example-level validation in examples/counting/counting.asl

@mrebollo mrebollo changed the title Fix .my_name resolution and enable counting example validation Fix .my_name resolution and add source(self) annotation for beliefs Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant