Skip to content

[Python SDK] Add docstring for Agent.run() method #106

@santoshkumarradha

Description

@santoshkumarradha

Summary

The Agent.run() method is one of the most important methods in the Python SDK but lacks a docstring explaining its purpose, parameters, and behavior.

Current State

  • File: sdk/python/agentfield/agent.py
  • Method: Agent.run()
  • Documentation: Missing docstring

What to Document

  1. Purpose: Explain that this method starts the agent and registers it with the control plane
  2. Parameters: Document any parameters the method accepts
  3. Return value: What does the method return (if anything)
  4. Blocking behavior: Note that this method blocks until the agent is stopped
  5. Network setup: Mention automatic port binding and callback URL resolution
  6. Example usage: Include a simple code example

Docstring Format

Use NumPy docstring style (consistent with existing SDK documentation):

def run(self, ...):
    """
    Start the agent and register with the AgentField control plane.

    This method starts the agent's HTTP server, registers with the control
    plane, and begins processing incoming execution requests. The method
    blocks until the agent is stopped.

    Parameters
    ----------
    param_name : type
        Description of parameter.

    Returns
    -------
    None

    Examples
    --------
    >>> agent = Agent(node_id="my-agent")
    >>> agent.run()  # Blocks until stopped
    """

Acceptance Criteria

  • Agent.run() has a complete docstring
  • Docstring follows NumPy style
  • Includes at least one usage example
  • Documentation renders correctly in IDE tooltips

Files

  • sdk/python/agentfield/agent.py

Using AI to solve this issue? Read our AI-Assisted Contributions guide for testing requirements, prompt strategies, and common pitfalls to avoid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomerssdk:pythonPython SDK related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions