Getting Started with Functions
Functions are Python-based Skills that extend your assistants with custom functionality. They use Forra SDK decorators to create callable functions that assistants can use during conversations.
Quick Start: Your First Function
Functions are typically built as part of an Assistant or Global Skill. Choose your deployment target first:
- Assistants - Functions specific to a single assistant
- Global Skills - Functions shared across multiple assistants
These guides show how to create, package, and deploy functions as part of their respective containers.
1. Install the Forra SDK
2. Create a Simple Function
Create a file called hello_skill.py:
from pydantic import Field
from forrasdk import forra
@forra.function(description="Say hello world with the name of the user")
def hello_world_function(
first_name: str = Field(description="The name of the person we want to write a hello world for")
):
return f"Hello {first_name} World!"
if __name__ == "__main__":
# Test locally
print(hello_world_function("Mart"))
3. Test Locally
Expected output:
4. Deploy Your Function
Functions are automatically deployed when you deploy their container Assistants or Global Skills.
For standalone function deployment to an existing assistant:
Learn more about deployment options →
What's Next?
Learn More About Functions
- Function Types - Explore synchronous functions, async functions, and webhooks
- Deployment - Package and deploy complex projects with dependencies
Understand Skills Architecture
- Skills Overview - Learn about Global vs Assistant Skills
- Global Skills - Create tenant-wide shared functions
- Assistant - Create assistant, that can contain functions Skills
Additional Topics
- Applications - Build custom frontend interfaces